package chatroom.fq.ley;
/* ------------------------------------------
 * This class defines a peer on the network;
 * which is described as "ip:port";
 * Lei Peng, 2012-10;
 * ------------------------------------------*/
class peer extends Object {
	public String ip;
	public int port;
	public String name;
	public peer(String ip,int port,String name){
		this.ip=ip;
		this.port=port;
		this.name=name;
	}
	//Default constructor;
	public peer(){
		this.ip="127.0.0.1";
		this.port=2425;
		this.name="User";
	}
	public static peer toObject(String str){
		String ss[]=str.split(":");
		int port=Integer.parseInt(ss[1]);
		return new peer(ss[0],port,ss[2]);
	}
	public String toString(){
		return new String(this.ip+":"+this.port);
	}
}
